<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title></title>
    <script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        .page {
            width: 100vw;
            height: 100vh;
            background-color: aqua;
            position: fixed;
            left: 0;
            top: 0;
        }
        
        .rMenu {
            width: 50vw;
            height: 100vh;
            left: 0;
            top: 0;
            transform: translateX(100vw);
            /* 平移到页面外面 */
            background-color: pink;
            transition: transform 0.5s;
        }
        
        .active {
            transform: translateX(50vw);
            /*平移到页面中间*/
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="page">
            首页
            <button @click="toggleMeun" type="button">切换侧边栏</button>
        </div>
        <div class="rMenu" :class="{active:isShow}">
            侧边栏
        </div>
    </div>
    <script type="text/javascript">
        let app = new Vue({
            el: "#app",
            data: {
                isShow: false
            },
            methods: {
                toggleMeun: function() {
                    this.isShow = !this.isShow;
                }
            }
        })
    </script>
</body>

</html>